{include file="public/head"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">{if $info}编辑{else /}添加{/if}广告</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-form" wid100 lay-filter="form">
                        <div class="layui-form-item">
                            <label class="layui-form-label">所属位置</label>
                            <div class="layui-input-inline">
                                <select name="as_id" lay-verify="required">
                                    <option value="">请选择所属广告位</option>
                                    {volist name="adsense" id="vo"}
                                    <option value="{$vo.id}">{$vo.title}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">广告名称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="title" lay-verify="required" placeholder="请输入广告名称" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">上传图片</label>
                            <div class="layui-input-inline">
                                <input name="pic" id="pic" placeholder="图片地址" class="layui-input">
                            </div>
                            <div class="layui-input-inline layui-btn-container" style="width: auto;">
                                <button type="button" class="layui-btn" id="picUpload">
                                    <i class="layui-icon">&#xe67c;</i>上传图片
                                </button>
                                <button class="layui-btn layui-btn-normal" layadmin-event="getAtta">选择图片</button >
                                <button class="layui-btn layui-btn-primary" layadmin-event="picShow">查看图片</button >
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">广告URL</label>
                            <div class="layui-input-inline">
                                <input type="text" name="url" placeholder="请输入广告链接" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">是否审核</label>
                            <div class="layui-input-block">
                                <input type="radio" name="open" value="1" title="启用">
                                <input type="radio" name="open" value="0" title="禁用">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">排序</label>
                            <div class="layui-input-inline">
                                <input type="text" name="sort" placeholder="从小到大排序" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">内容</label>
                            <div class="layui-input-block">
                                <textarea placeholder="请输广告内容" name="content" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="hidden" name="id">
                                <button class="layui-btn" lay-submit lay-filter="{if $info}edit-btn{else /}add-btn{/if}">确认保存</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/foot"/}
<script>
    layui.config({
        base: '__LAYADMIN__/',
        version: true
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','ad','form'],function(){
        var form = layui.form;
        form.val("form", {$info|raw})
    });
</script>
</body>
</html>